package com.wqtz.chechai.view.activities;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.avos.avoscloud.AVUser;
import com.orhanobut.logger.Logger;
import com.wqtz.chechai.R;
import com.wqtz.chechai.base.BaseActivity;
import com.wqtz.chechai.presenter.BasePresent;
import com.wqtz.chechai.utils.StringUtils;
import com.wqtz.chechai.utils.ToastUtils;
import com.wqtz.chechai.widget.ClearEditText;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 项目名称： CheChai
 * 创建人 : Liberation
 * 创建时间: 2016/12/19 11:21
 */

public class GestureSignActivity extends BaseActivity {
	@BindView(R.id.iv_back)
	ImageView mIvBack;
	@BindView(R.id.tv_title)
	TextView mTvTitle;
	@BindView(R.id.tv_notice)
	TextView mTvNotice;
	@BindView(R.id.tv_input_notice)
	TextView mTvInputNotice;
	@BindView(R.id.tv_input)
	ClearEditText mTvInput;
	@BindView(R.id.btn_sign_next)
	Button mBtnSignNext;
	private String pwd;
	private final int REQUSET_CODE=130;

	@Override
	public void init() {
		ButterKnife.bind(this);
		AVUser user = AVUser.getCurrentUser();
		pwd = (String) user.get("pwd");
		Logger.e(pwd);

	}

	@Override
	public void loadData() {


	}

	@Override
	public int setContentViews() {
		return R.layout.activity_gesturesign;
	}

	@Override
	public BasePresent createPresenter() {
		return null;
	}


	@OnClick({R.id.iv_back, R.id.tv_title, R.id.tv_notice, R.id.tv_input_notice, R.id.btn_sign_next})
	public void onClick(View view) {
		switch (view.getId()) {
			case R.id.iv_back:
				this.finish();
				break;
			case R.id.tv_title:
				break;
			case R.id.tv_notice:
				break;
			case R.id.tv_input_notice:
				break;
			case R.id.btn_sign_next:
				if (!(StringUtils.isEmpty(mTvInput.getText().toString()))&&pwd.equals(mTvInput.getText().toString())) {
					Logger.e(mTvInput.getText().toString()+"===="+pwd);
					Intent inntent = new Intent(this,GestureSettingActivity.class);
					startActivityForResult(inntent,REQUSET_CODE);
					this.finish();
				}else {
					ToastUtils.show(this,"密码错误！",500);
				}
				break;
		}
	}

	@Override
	protected void onResume() {
		super.onResume();
		activitys.add(this); //添加当前的activity
	}
}
